filechooser: Prevent a crash
authorMatthias Clasen <mclasen@redhat.com>
Sat, 12 Sep 2020 14:40:13 +0000 (10:40 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 12 Sep 2020 14:40:13 +0000 (10:40 -0400)
With csd, we are handling external widgets when
there is an entry in the headerbar. Use a weak ref
to prevent that pointer from going stale. This fixes
a crash when cancelling a save dialog.

Fixes: #3110
gtk/gtkfilechooserwidget.c

index 12d7a1400108dd21d0d8d2548d04da5eadc0c32a..16375eab290f626061ab773edc01594c1862e3eb 100644 (file)
@@ -2322,6 +2322,7 @@ save_widgets_create (GtkFileChooserWidget *impl)
     {
       location_entry_disconnect (impl);
       impl->location_entry = impl->external_entry;
+      g_object_add_weak_pointer (impl->external_entry, (gpointer *)&impl->location_entry);
       location_entry_setup (impl);
 
       g_signal_connect_after (gtk_entry_get_key_controller (GTK_ENTRY (impl->external_entry)),